package ink.lovejinhu.swardToOffer;

public class Offer_053_II {
    public int missingNumber(int[] nums) {
        int[] ints = new int[nums.length+1];
        for (int i = 0; i < ints.length; i++) {
            ints[i] = i;
        }
        int location=-1;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != ints[i]) {
              location=ints[i];
              break;
            }
        }
        if (location==-1) {
            return ints[ints.length-1];
        } else {
            return location;
        }
    }
}
